<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>droplist</title>
    <style>
        p{
            white-space: pre
        }
    </style>
</head>
<body>

<p>
    // dto
    
    public class <span  th:text="${entity}"></span>DropListDto {

        private String <span  th:text="${searchField}"></span>;
        private Integer size = 50;

        public String get<span class="firstCapital"  th:text="${searchField}"></span>() {
            return <span  th:text="${searchField}"></span>;
        }

         public void set<span class="firstCapital"  th:text="${searchField}"></span>(String <span  th:text="${searchField}"></span>) {
            this.<span  th:text="${searchField}"></span> = <span  th:text="${searchField}"></span>;
        }

        public Integer getSize() {
            return size;
        }

        public void setSize(Integer size) {
            this.size = size;
        }
    }

</p>
<p>
    // dao

    public List&lt;<span  th:text="${entity}"></span>&gt; selectForDroplist(<span  th:text="${entity}"></span>DropListDto <span class="hump" th:text="${entity}"></span>DropListDto) {
        Example example = new Example(<span  th:text="${entity}"></span>.class);
        Example.Criteria criteria = example.createCriteria();
        if (StringUtils.isNotEmpty(<span class="hump" th:text="${entity}"></span>DropListDto.get<span class="firstCapital"  th:text="${searchField}"></span>())) {
            criteria.andLike("<span class="hump"  th:text="${searchField}"></span>", "%" + <span class="hump" th:text="${entity}"></span>DropListDto.get<span class="firstCapital"  th:text="${searchField}"></span>() + "%");
        }

        return selectByExampleAndRowBounds(example, new RowBounds(), false);
    }
</p>
<p>
    // service

    List&lt;TitleValueVo&gt; droplist(<span  th:text="${entity}"></span>DropListDto <span class="hump" th:text="${entity}"></span>DropListDto);
</p>

<p>
    // service impl

    @Override
    public List&lt;TitleValueVo&gt; droplist(<span  th:text="${entity}"></span>DropListDto <span class="hump" th:text="${entity}"></span>DropListDto) {
    List&lt;TitleValueVo&gt; titleValueVoList = new ArrayList&lt;&gt;();
        PageHelper.startPage(0, <span class="hump" th:text="${entity}"></span>DropListDto.getSize());
        List&lt;<span  th:text="${entity}"></span>&gt; <span class="hump" th:text="${entity}"></span>List = <span class="hump" th:text="${entity}"></span>Dao.selectForDroplist(<span class="hump" th:text="${entity}"></span>DropListDto);
        PageInfo&lt;<span  th:text="${entity}"></span>&gt; pageInfo = new PageInfo&lt;&gt;(<span class="hump" th:text="${entity}"></span>List);
        <span class="hump" th:text="${entity}"></span>List = pageInfo.getList();

        if (CollectionUtils.notEmpty(<span class="hump" th:text="${entity}"></span>List)) {
            for (<span  th:text="${entity}"></span> <span class="hump" th:text="${entity}"></span> : <span class="hump" th:text="${entity}"></span>List) {
                TitleValueVo titleValueVo = new TitleValueVo();
                titleValueVo.setTitle(<span class="hump" th:text="${entity}"></span>.get<span class="firstCapital"  th:text="${searchField}"></span>());
                titleValueVo.setValue(<span class="hump" th:text="${entity}"></span>.getId());
                titleValueVoList.add(titleValueVo);
            }
        }
        return titleValueVoList;
    }
</p>

<p>
    // controller  
    
    @ApiOperation("下拉列表")
    @RequestMapping(path = "droplist", method = RequestMethod.POST)
    public RestfulApiResponse&lt;List&lt;TitleValueVo&gt;&gt; droplist(@RequestBody <span  th:text="${entity}"></span>DropListDto <span class="hump" th:text="${entity}"></span>DropListDto) {
        return RestfulApiResponse.success("success", <span class="hump" th:text="${entity}"></span>Service.droplist(<span class="hump" th:text="${entity}"></span>DropListDto));
    }
</p>

<script>
    let arr = document.getElementsByClassName('hump');
    for (const el of arr) {
        const ch = el.innerText[0].toLowerCase();
        el.innerText = ch + el.innerText.substr(1);
    }

    let arr2 = document.getElementsByClassName('firstCapital');
    for (const el of arr2) {
        const ch = el.innerText[0].toUpperCase();
        el.innerText = ch + el.innerText.substr(1);
    }
</script>
</body>
</html>